


/*var str ='开始了！'
function loop(){
	var i = 10000
	while(i>0){
		if(i == 500) console.log('哈哈，500我先打印了str:'+str)
		i--
	}
	if(i == 0) console.log('哈哈，我先打印了str:'+str)
}
loop()
console.log('我想打印str:'+str+'需要等待loop执行完')*/


var fs = require('fs'); 

//同步
 var filenames = fs.readdirSync(".");
 for (i = 0; i < filenames.length; i++) {
     console.log(filenames[i]);
 }
 console.log('Current uid: ' + process.pid);

//异步
 fs.readdir(".", function (err, filenames) {
     var i;
     for (i = 0; i < filenames.length; i++) {
         console.log(filenames[i]);
     }
 });
 console.log('Current uid: ' + process.pid);
